import $ from '../common';
Page({
  data: {
    titleHeight: $.gData().titleHeight,
    statuHeight: $.gData().statuHeight,
    info:[],
    page:1,
    tip:"下来加载更多"
  },
  getinfo(){
    const {page,info}=this.data
    $.get('/teacher/lesson/filter',{
      is_reviewed:'',
      limit:20,
      page
    },res=>{
      if(res.lessons.length<20){
        this.data.tip='已经到底了'
      }else{
        this.data.tip='下来加载更多'
      }
      this.data.page++
      this.setData({
        info:[...info,...res.lessons],
        tip:this.data.tip,
      })
    })

  },
  //上拉触底事件
  onReachBottom(){
    console.log('触底了！！！');
    this.getinfo()
  },
  // 去往详情
  godetails(e){
    const {lesson_uuid}=e.currentTarget.dataset
    $.navigateTo(`/classaboutPart/feedbackdetails?lesson_uuid=${lesson_uuid}`)
  },
  onLoad(e) {
    this.getinfo()
  },
  onShow() {}
})